<template>
	<!-- 退款商品申请结果 Refund result -->
	<view>
		<u-navbar title="退款" :autoBack="true" :placeholder="true" bgColor="#F8F9FE"></u-navbar>
		<view class="state-main card">
			<view v-if="details.refoud_status===2">
				<image src="http://qiniu.suboshimuying.cn/static/cart/check.png" mode=""></image>
				<text>审核通过</text>
				<text
					style="color: #646566;">({{details.refound.apply_type, details.refound.apply_status, details.refound.remit_status | refoudName}})</text>
			</view>
			<view v-if="details.refoud_status===1">
				<image src="http://qiniu.suboshimuying.cn/static/refund/ic_loc2@2x (1).png" mode=""></image>
				<text>审核中请稍等</text>
			</view>
			<view v-if="details.refoud_status===3">
				<image src="http://qiniu.suboshimuying.cn/static/refund/ic_loc2@2x (2).png" mode=""></image>
				<text>审核失败</text>
			</view>
			<view style="padding-left: 48rpx;color: #646566;font-size: 24rpx;">
				{{$u.timeFormat(details.refound.updatetime, 'yyyy年mm月dd日')}}
			</view>

		</view>
		<view class="state-main card">
			<view class="u-line-1">
				<image src="http://qiniu.suboshimuying.cn/static/order/ic_loc2.png" mode=""></image>
				<text>{{details.pladress}}</text>
			</view>
			<view style="padding-left: 48rpx;color: #646566;font-size: 24rpx;" class="u-line-1">
				{{details.plname}}&nbsp;&nbsp;{{details.plmobile}}
			</view>
		</view>
		<!-- 商品信息 -->
		<goodsList :list="details.goods_list" />

		<!-- <view class="goodCard card">
			<view class="goodCard-main">
				<image class="mainLeft" src="http://qiniu.suboshimuying.cn/static/logo.png" mode=""></image>
				<view class="mainRight">
					<view class="name u-line-2">
						好奇（Huggies）心钻装小森林纸尿裤XL32片(12-17kg)加大号婴儿尿不湿超薄透气
					</view>
					<view class="priceNum">
						<text>¥30.23</text>
						<text style="color: rgba(0, 0, 0, 0.8);">✖️12</text>
					</view>
				</view>
			</view>
			<view class="goodCard-footer">
				<text style="color: rgba(0, 0, 0, 0.8);margin-right: 10rpx; ">共计1件</text>
				<text style="color: rgba(0, 0, 0, 0.8);">实付款:</text>
				<text>￥182.99</text>
			</view>
		</view> -->

		<view class="otherBox card">
			<view class="otherBox-row">
				<text>下单备注</text>
				<text class="right u-line-1">{{details.remark ||''}}</text>
			</view>
			<view class="otherBox-row">
				<text>订单编号</text>
				<text class="right u-line-1">{{details.order_no}}</text>
				<text style="color: #969799;" @click="copy(details.order_no)">复制</text>
			</view>
			<view class="otherBox-row" v-for="item in details.status_list" :key="item.id">
				<text>{{item.status | itemName}}</text>
				<text class="right u-line-1">{{item.createtime}}</text>
			</view>
		</view>

		<view class="fixedBox"
			v-if="details.refound.apply_type===1 &&details.refound.apply_status ===2 && details.refound.remit_status ===1">
			<view class="fixedBox-item"
				@click="toUrl(`/subPages/byPost/byPost?refound=${JSON.stringify(details.refound)}`)">
				去邮寄
			</view>
		</view>

	</view>
</template>

<script>
	import goodsList from '@/subPages/orderDetails/goodsList.vue'
	export default {
		data() {
			return {
				details: {}
			};
		},
		components: {
			goodsList
		},
		onLoad(option) {
			// console.log(option);
			this.getorderDet(option.id)
		},
		filters: {
			itemName(value) {
				switch (value) {
					case 1:
						return "下单时间"
						break;
					case 3:
						return "付款时间"
						break;
					case 5:
						return "发货时间"
						break;
					case 6:
						return "到货时间"
						break;
					case 7:
						return "评论时间"
						break;
					case 11:
						return "取消时间"
						break;
					case 12:
						return "退货时间"
						break;
					default:
						break;
				}
			},
			// 退货信息
			refoudName(apply_type, apply_status, remit_status) {
				switch (apply_type) {
					case 1: //退货退款  （已收货退款）
						if (apply_status == 1) return "待审核退货退款"
						if (apply_status == 2 && remit_status == 1) return "审核成功等待邮寄"
						if (apply_status == 2 && remit_status == 2) return "已邮寄,等待商家收货"
						if (apply_status == 2 && remit_status == 3) return "商家已确认收货"
						if (apply_status == 3) return "商家已拒绝"
						break;
					case 2: //退款  （未收到货退款）
						if (apply_status == 1) return "待审核退款"
						if (apply_status == 2 && remit_status == 2) return "同意退款,等待退款"
						if (apply_status == 2 && remit_status == 3) return "商家已退款"
						if (apply_status == 3) return "商家拒绝退款"
						break;
					default:
						break;
				}
			}
		},
		methods: {
			// 跳转
			toUrl(url) {
				uni.navigateTo({
					url
				})
			},
			// 获取订单详情
			async getorderDet(id) {
				let res = await this.$api.getorderDet({
					id
				})
				this.details = res.data
				//  refoud_status 1:审核 2:通过 3:失败
				// console.log(res);
			},
			// 复制按钮
			copy(copyData) {
				uni.setClipboardData({
					data: String(copyData), //要被复制的内容 :String
					success: () => { //复制成功的回调函数
						uni.showToast({ //提示
							title: '复制成功'
						})
					}
				});
			},
		}
	}
</script>

<style>
	page {
		box-sizing: border-box;
		padding: 24rpx;
	}
</style>
<style lang="scss">
	.state {
		&-main {
			image {
				width: 32rpx;
				height: 32rpx;
				vertical-align: middle;
				margin-right: 16rpx;
			}
		}
	}

	.goodCard {

		&-main {
			display: flex;
			justify-content: space-between;
			box-sizing: border-box;
			padding-bottom: 30rpx;
			border-bottom: 1rpx solid rgba(171, 171, 171, 0.2);

			.mainLeft {
				width: 180rpx;
				height: 180rpx;
			}

			.mainRight {
				flex: 1;
				margin-left: 24rpx;
				font-weight: 500;
				text-align: left;
				line-height: 40rpx;

				.name {
					height: 88rpx;
					line-height: 44rpx;

					color: rgba(0, 0, 0, 0.8);
					font-size: 26rpx;
				}

				.priceNum {
					color: $priceText;
					margin-top: 55rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					font-size: 26rpx;
					font-weight: 400;
				}
			}
		}

		&-footer {
			margin-top: 18rpx;
			text-align: right;
			height: 40rpx;
			line-height: 40rpx;
			color: $priceText;
			font-size: 28rpx;
			font-weight: 400;
		}
	}

	.otherBox {

		&-row {
			height: 64rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			color: rgba(50, 50, 51, 1);
			font-size: 26rpx;
			font-weight: 400;

			.right {
				flex: 1;
				color: rgba(0, 0, 0, 0.8);
				font-size: 26rpx;
				font-weight: 500;
				display: inline-block;
				margin-left: 40rpx;
			}
		}
	}

	.fixedBox {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 188rpx;
		background-color: #fff;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		text-align: right;
		box-sizing: border-box;
		padding: 0 32rpx 68rpx;

		&-item {
			margin-left: 24rpx;
			width: 236rpx;
			height: 80rpx;
			border-radius: 80rpx;
			background: radial-gradient(235.8% 163.9% at 132.1% 0%, rgba(255, 245, 252, 1) 0%, rgba(208, 132, 255, 1) 23%, rgba(121, 101, 255, 1) 56.99999999999999%, rgba(131, 111, 255, 1) 82%, rgba(130, 111, 255, 1) 100%);
			line-height: 80rpx;
			text-align: center;
			color: rgba(255, 255, 255, 1);
			font-size: 28rpx;
			font-weight: 600;


		}

		.cancel {
			color: rgba(100, 101, 102, 1) !important;
			background: #fff !important;
			border: 1rpx solid rgba(220, 222, 224, 1) !important;

		}
	}
</style>
